
var Feedback = {

	popup: function (e, p2, id, status) {
		$.cookie('id_', id);
		
		p2 = query(p2);
		$.cookie('p2', p2);
		
		var c1 = 'info.php?do=Feedback.edit&id=' + id;	
		var c2 = 'info.php?do=Feedback.view&id=' + id;

		var a1 = ['编辑信息', 'url', 'dialog_edit_', '600x400'];
		var a2 = ['查看信息', 'url', 'Common.dialog_view_', '600x400'];
		
		var s = c2;

		popup(e, [a2], s);
	},
	
	view: function(p2, id) {
		$.cookie('id_', id);
		
		p2 = query(p2);
		$.cookie('p2', p2);
		
		var url = 'info.php?do=Feedback.view&id=' + id;
		
		this.dialog_view_(url, '查看信息', '600x400');
	},
	
	dialog_view_: function (url, title, xy) {
		var result = Common.result();
		$('#dialog_view').dialog('option', 'buttons', {
			"关闭": function() { 
				$(this).dialog("close");
			},
			
			"已答复": function() { 
				if (!confirm("确认是否已读？")) {
					return false;
				}				
				
				var body = {};
				body.id = $.cookie('id_');
				body.status = 2;
				
				$(this).dialog("close");

				var url = 'info.php?do=Feedback.status';
				var p2 = $.cookie('p2');
				if (p2 != null) {
					url += p2;
				}

				$.post(url, body, function(data) {
					$(result).html(data);
				});
			}
		});

		dialog_view(url, title, xy);
	}
};
